/**
 * 
 */
package com.hanhai.zrb.mobile.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.hanhai.zrb.api.biz.dao.mybatis.UserDao;
import com.hanhai.zrb.api.biz.service.CommonCounterService;
import com.hanhai.zrb.api.biz.service.IntentionService;
import com.hanhai.zrb.api.biz.service.UserStatisticDetailService;
import com.hanhai.zrb.mobile.service.LoginUserService;
import com.hanhai.zrb.model.common.CommonCounterKey;
import com.hanhai.zrb.model.intention.Intention;
import com.hanhai.zrb.model.user.User;
import com.hanhai.zrb.model.user.UserStatisticDetail;

/**
 * @author ricky
 *
 */
@Service("loginUserService")
public class LoginUserServiceImpl implements LoginUserService{

	@Resource
	private UserDao  userDao;
	
	@Resource
	private UserStatisticDetailService  userStatisticDetailService;
	
	@Resource
	private IntentionService intentionService;
	
	@Resource
	private CommonCounterService commonCounterService;
	
	@Override
	public User findByLoginName(String loginName) {
		User  user = null;
		if(StringUtils.isNumeric(loginName)){
			user = userDao.getLoginUser(loginName, null);
		}else{
			user = userDao.getLoginUser(null, loginName);
		}
		if(user==null){
			return null;
		}
		return user;
	}

	@Override
	public User findById(Long id) {
		return userDao.findById(id);
	}

}
